package com.yao.component.circle;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

public class BaseTopViewUtil {
	static Activity mActivity;
	/**
	 * 设置顶部标题栏的文字
	 */
	public static void setTitleText(Activity activity,String text){
		TextView titleTv = (TextView) activity.findViewById(R.id.top_title_tv);
		titleTv.setText(text);
		mActivity = activity;
	}
	public static void toastText(String text){
		if(mActivity!=null){
			Toast.makeText(mActivity, text, Toast.LENGTH_SHORT).show();
		}
	}
	public static void setTitleText2(View view,String text){
		TextView titleTv = (TextView) view.findViewById(R.id.top_title_tv);
		titleTv.setText(text);
	}
	/**
	 * 设置顶部右边的文字
	 */
	public static void setRightText(Activity activity,String text,OnClickListener listener){
		TextView rightTv = (TextView) activity.findViewById(R.id.top_right_tv);
		rightTv.setText(text);
		rightTv.setOnClickListener(listener);
	}
	public static void setRightText2(View view,String text,OnClickListener listener){
		TextView rightTv = (TextView) view.findViewById(R.id.top_right_tv);
		rightTv.setText(text);
	}

	/**
	 * 设置顶部右边的图片
	 */
	public static void setRightImg(Activity activity,int id,OnClickListener listener){
		ImageView rightIv = (ImageView) activity.findViewById(R.id.top_right_iv);
		rightIv.setVisibility(View.VISIBLE);
		rightIv.setOnClickListener(listener);
		rightIv.setImageResource(id);
//		rightIv.setBackgroundResource(id);
	}
	public static void setRightImg2(View view,int id,OnClickListener listener){
		ImageView rightIv = (ImageView) view.findViewById(R.id.top_right_iv);
		rightIv.setVisibility(View.VISIBLE);
		rightIv.setOnClickListener(listener);
		rightIv.setImageResource(id);
//		rightIv.setBackgroundResource(id);
	}

	/**
	 * 设置顶部左边的图片
	 */
	public static void setLeftImg(Activity activity,int id,OnClickListener listener){
		ImageView leftIv = (ImageView) activity.findViewById(R.id.top_left_iv);
		leftIv.setVisibility(View.VISIBLE);
		leftIv.setImageResource(id);
//		leftIv.setBackgroundResource(id);
		leftIv.setOnClickListener(listener);
	}
	public static void setLeftImg2(View view,int id,OnClickListener listener){
		ImageView leftIv = (ImageView) view.findViewById(R.id.top_left_iv);
		leftIv.setVisibility(View.VISIBLE);
		leftIv.setOnClickListener(listener);
		leftIv.setImageResource(id);
//		leftIv.setBackgroundResource(id);
	}

	/**
	 * 设置顶部左边的文字
	 */
	public static void setLeftText(Activity activity,String text,OnClickListener listener){
		TextView leftTv = (TextView) activity.findViewById(R.id.top_left_tv);
		leftTv.setText(text);
		leftTv.setOnClickListener(listener);
	}

	public static void setLeftText2(View view,String text,OnClickListener listener){
		TextView leftTv = (TextView) view.findViewById(R.id.top_left_tv);
		leftTv.setOnClickListener(listener);
		leftTv.setText(text);
	}
}
